gdk: Add a way to show included backends
authorMatthias Clasen <mclasen@redhat.com>
Fri, 19 Feb 2016 03:03:12 +0000 (22:03 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 19 Feb 2016 03:03:12 +0000 (22:03 -0500)
Set GDK_BACKEND=help to see a list of all inluded GDK backends.

docs/reference/gtk/running.sgml
gdk/gdkdisplaymanager.c

index 7f3812046a068fe206c37c2cffdab2d01766b797..accd9732245bc0c3a0537ce225d33a1baf9af62f 100644 (file)
@@ -477,7 +477,7 @@ nevertheless.
   <para>
     If set, selects the GDK backend to use. Selecting a backend requires that
     GTK+ is compiled with support for that backend. The following backends can
-    be selected:
+    be selected, provided they are included in the GDK libraries you are using:
     <variablelist>
 
       <varlistentry>
@@ -513,7 +513,8 @@ nevertheless.
     </variablelist>
     Since 3.10, this environment variable can contain a comma-separated list
     of backend names, which are tried in order. The list may also contain
-    a *, which means: try all remaining backends.
+    a *, which means: try all remaining backends. The special value "help" can
+    be used to make GDK print out a list of all available backends.
     For more information about selecting backends, see the gdk_display_manager_get() function.
   </para>
 </formalpara>
index bc3471f83a0475fb2f7e192529691a0d0d0ff4de..cbb5c4cf386ea82bdded1fa36af6c203061040dc 100644 (file)
@@ -441,6 +441,15 @@ gdk_display_manager_open_display (GdkDisplayManager *manager,
   backend_list = g_getenv ("GDK_BACKEND");
   if (backend_list == NULL)
     backend_list = allowed_backends;
+  else if (g_strcmp0 (backend_list, "help") == 0)
+    {
+      fprintf (stderr, "Supported GDK backends:");
+      for (i = 0; gdk_backends[i].name != NULL; i++)
+        fprintf (stderr, " %s", gdk_backends[i].name);
+      fprintf (stderr, "\n");
+
+      backend_list = allowed_backends;
+    }
   backends = g_strsplit (backend_list, ",", 0);
 
   display = NULL;